/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.carrito.jdbc.dao;

import com.carrito.jsf.persistence.Articulo;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 *
 * @author oscarc
 */
public class ImplArticulo extends HibernateDaoSupport implements IfaceArticulo {

    public static final Logger logger = Logger.getLogger(ImplArticulo.class);

    public void insert(Articulo obj) {
        logger.info("Ingreso metodo insert");
        getHibernateTemplate().save(obj);
        logger.info("Inserccion existosa");
    }

    public void delete(Articulo obj) {
        logger.info("Ingreso metodo delete");
        getHibernateTemplate().delete(obj);
        logger.info("Eliminacion exitosa");
    }

    public void update(Articulo obj) {
        logger.info("Ingreso metodo update");
        getHibernateTemplate().merge(obj);
        logger.info("Actualizacion exitosa");
    }

    public List<Articulo> getAll() {
        logger.info("Ingreso metodo getAll");
        return getHibernateTemplate().find("FROM Articulo");
    }
}
